Add Run Energy depleting/restoring#423
Add Run Energy depleting/restoring#423Tomm0017 wants to merge 5 commits intoapollo-rsps:kotlin-experimentsfrom Tomm0017:run_energy
Conversation
If required, we can revert this and modify the formulas to multiply the values by 100 and then divide accordingly.
Codecov Report
@@ Coverage Diff @@
## kotlin-experiments #423 +/- ##
========================================================
- Coverage 23.23% 23.19% -0.04%
Complexity 811 811
========================================================
Files 643 643
Lines 11123 11139 +16
Branches 1632 1634 +2
========================================================
Hits 2584 2584
- Misses 8251 8267 +16
Partials 288 288
Continue to review full report at Codecov.
|
| Position old = player.getPosition(); | ||
| player.getWalkingQueue().pulse(); | ||
|
|
||
| if (player.getSecondDirection() != Direction.NONE) { |
There was a problem hiding this comment.
This isn't right. We should only decrement the run energy when the player actually moves (see WalkingQueue). The direction could be set but the collision maps said this is an invalid move.
There was a problem hiding this comment.
I wasn't fond of the condition, but it seemed to be the best fitting choice for what needed to be done. Sorry if I'm wrong here and just wasting your time, but I believe the direction is only set if the collision map allows the movement (see https://github.com/apollo-rsps/apollo/blob/kotlin-experiments/game/src/main/java/org/apollo/game/model/entity/WalkingQueue.java#L156).
Also, am I wrong to assume that if I use WalkingQueue.isRunning() & WalkingQueue.size(), then I would run into the issue that you warned about? I believe when adding steps into the walking queue, it won't check for collision.
There was a problem hiding this comment.
Hmm, I need to re-look at the assignment of secondDirection, you may be right there.
There was a problem hiding this comment.
The code is fine as is, and what we expect. That's the only assignment of secondDirection and the point @Tomm0017 made is valid.
| * @param weight the amount of weight to be taken into account when | ||
| * determining how much run energy will be depleted. | ||
| */ | ||
| public void decrementRunEnergy(double weight) { |
There was a problem hiding this comment.
@Major- any thoughts on this being in core? Seems like it might be the responsibility of a plugin, but I'm not sure.
Addresses Issue #87 in which run energy depletion and restoring is requested